AC_PREREQ([2.63])
AC_INIT([bforcer], [0.1], [alvarommorais@gmail.com])
AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE([-Wall -Werror gnu])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile])

AC_PROG_CXX
AC_PROG_CC

AX_BOOST_BASE([1.33.1])
AX_BOOST_REGEX
AX_BOOST_FILESYSTEM
AX_BOOST_THREAD
AX_COMPILER_VENDOR				

AX_CXX_HAVE_STL
AX_PCRECPP


# Checks for libraries.
AC_CHECK_LIB(	[ssh], [ssh_options_new], 
		[], 
		[ AC_MSG_ERROR(	[I can't locate libssh. Aborting.]  ) ]
	    )
		
AC_CHECK_LIB([curses], [initscr])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_MODE_T

# Checks for library functions.
AC_CHECK_FUNCS([strdup])

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])


# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL

# Debug Option
AC_ARG_ENABLE([debug],
        [  --enable-debug           Turn on debugging (default:no)],
	[case "${enableval}" in
	       yes) debug=true ;;
	       no)  debug=false ;;
	       *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
	esac],[debug=false])
AM_CONDITIONAL([WANT_DEBUG], [test x$debug = xtrue])
AM_COND_IF(	[WANT_DEBUG],
		[ AC_DEFINE( [DEBUG], 0, [Set to 1 to enable debug] ) ]
		[ AC_DEFINE( [DEBUG], 1, [Set to 1 to enable debug] ) ]
	  )

# NCurses Option
AC_ARG_ENABLE([ncurses],
        [  --enable-ncurses           Turn on ncurses (default:yes)],
	[case "${enableval}" in
	       yes) ncurses=true ;;
	       no)  ncurses=false ;;
	       *) AC_MSG_ERROR([bad value ${enableval} for --enable-nacurses]) ;;
	esac],[ncurses=true])
AM_CONDITIONAL([WANT_NCURSES], [test x$ncurses = xtrue])
AM_COND_IF(	[WANT_NCURSES],
		[ AC_DEFINE( [WANT_NCURSES], 0, [Set to 1 to enable ncurses] ) ]
		[ AC_DEFINE( [WANT_NCURSES], 1, [Set to 1 to enable ncurses] ) ]
	  )

# Pcrecpp Option
AC_ARG_ENABLE([pcrecpp],
        [  --enable-pcrecpp           Turn on pcrecpp(Default:no)],
	[case "${enableval}" in
	       yes) pcrecpp=true ;;
	       no)  pcrecpp=false ;;
	       *) AC_MSG_ERROR([bad value ${enableval} for --enable-pcrecpp]) ;;
	esac],[pcrecpp=false])
AM_CONDITIONAL([WANT_PCRECPP], [test x$pcrecpp = xtrue])
AM_COND_IF(	[WANT_PCRECPP],
		[ AC_DEFINE( [WANT_PCRECPP], 0, [Set to 1 to enable pcrecpp] ) ]
		[ AC_DEFINE( [WANT_PCRECPP], 1, [Set to 1 to enable pcrecpp] ) ]
	  )

AC_OUTPUT
